home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 4
/
Amiga Tools 4.iso
/
tools
/
netzwerk
/
tcp-ip
/
netface-beta
/
bin
/
mailq.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1996-02-26
|
3KB
|
86 lines
/* Output tuning */
queue_len = 20
host_len = 40
/* Make sure we have the libraries */
if ~show('Libraries', 'rexxarplib.library') then
if ~addlib('rexxarplib.library', 0, -30) then do
say "No rexxarplib, so we can't scan the spool!"
exit
end
if ~show('Libraries', 'rexxsupport.library') then
if ~addlib('rexxsupport.library', 0, -30) then do
say "No rexxsupport library, so we can't scan the spool!"
exit
end
spooldir = "UUSPOOL:"
if spooldir = "" then do
say "Can't find the name of the directory to scan."
exit
end
old = pragma('Directory', spooldir)
/* Get a list of files in it */
count = filelist('D.???B????', files)
/* Now, process them */
if count = 0 then
say "No mail waiting to go"
else do
say left("Queue number", queue_len) ,
|| left("Mail Destination", host_len) || "Time in queue"
nowdays = date('Internal')
nowminutes = time('Minutes')
do i = 1 to count
parse value files.i with 'D.???B????'queue
parse value statef(files.i) with . . . . filedays fileminutes .
days = nowdays - filedays
/* now days is day difference */
minutes = nowminutes - fileminutes
/* minutes is minute difference */
if minutes < 0 then do
/* then it's 1 less day than we think */
days = days /*+*/- 1
minutes = minutes + 1440
end
hours = 24 * days + minutes % 60
minutes = minutes // 60
destination = getdestination(files.i)
if destination = "" then iterate
out = left(i, queue_len) || left(destination, host_len)
select
when hours = 0 & minutes = 0 then say out || "no time"
when hours = 0 & minutes = 1 then say out || "1 minute"
when hours = 0 then say out || minutes "minutes"
when hours = 1 & minutes = 0 then say out || "1 hour"
when hours = 1 & minutes = 1 then
say out || "1 hour 1 minute"
when hours = 1 then
say out || "1 hour" minutes "minutes"
when minutes = 0 then say out || hours "hours"
when minutes = 1 then say out || hours "hours 1 minute"
otherwise say out || hours "hours" minutes "minutes"
end
end
end
say ""
exit
getdestination: procedure
parse arg file
if ~open(in, file, 'Read') then return ""
/* search for newsgroups line */
line = ""
do while (~eof(in)) & (left(line,3) ~= "To:")
line = readln(in)
end
call close in
return substr(line,5)
/* end of file */